package com.yiyan.study;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yiyan.study.model.DesensitizationDTO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 启动类
 */
@SpringBootApplication
@Slf4j
@RestController
public class DesensitizationApplication {

    private static final DesensitizationDTO dto = com.yiyan.study.model.DesensitizationDTO.builder()
            .username("李师傅")
            .phoneNumber("12300000456")
            .email("li@gmail.com")
            .address("XX.YY.DD.FF")
            .note("123456789")
            .build();

    public static void main(String[] args) throws JsonProcessingException {
        SpringApplication.run(DesensitizationApplication.class, args);

        ObjectMapper mapper = new ObjectMapper();
        String s = mapper.writeValueAsString(dto);
        log.info("Json : {}", s);
    }

    @GetMapping("/test")
    public DesensitizationDTO desensitizationTest() {
        return dto;
    }
}
